import { getRefreshToken } from '@/utils/auth'
import constant from '@/utils/constant'
import storage from '@/utils/storage'
const getters = {
  token: state => state.user.token,
  refreshToken: state => {
    const token = getRefreshToken()
    state.user.refreshToken = token
    return state.user.refreshToken
  },
  userInfo: state => {
    const userInfo = storage.get(constant.userInfo)
    state.user.userInfo = userInfo
    return state.user.userInfo
  },
  systemConfig: state => {
    const systemConfig = storage.get(constant.systemConfig)
    state.system.systemConfig = systemConfig
    return state.system.systemConfig
  },
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  roles: state => state.user.roles,
  permissions: state => state.user.permissions,
	allPermissions: state => state.user.allPermissions
}
export default getters
